From f623329e95c7d6f43874cf667f5036dc01793331 Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Fri, 23 Nov 2012 12:53:35 -0600 Subject: [PATCH] Allow switching to recent:/// even though GIO thinks it is not a native file That URI is not a native file, and so it would not show up if local_only=TRUE. Add a special case for it so that recent:/// can always be visited. Signed-off-by: Federico Mena Quintero --- gtk/gtkfilechooserdefault.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c index be7a958982..85111de0f1 100644 --- a/gtk/gtkfilechooserdefault.c +++ b/gtk/gtkfilechooserdefault.c @@ -7544,6 +7544,19 @@ out: g_object_unref (cancellable); } +static gboolean +file_is_recent_uri (GFile *file) +{ + GFile *recent; + gboolean same; + + recent = g_file_new_for_uri ("recent:///"); + same = g_file_equal (file, recent); + g_object_unref (recent); + + return same; +} + static gboolean gtk_file_chooser_default_update_current_folder (GtkFileChooser *chooser, GFile *file, @@ -7560,7 +7573,8 @@ gtk_file_chooser_default_update_current_folder (GtkFileChooser *chooser, operation_mode_set (impl, OPERATION_MODE_BROWSE); - if (impl->local_only && !g_file_is_native (file)) + if (impl->local_only && !g_file_is_native (file) + && !file_is_recent_uri (file)) /* GIO considers "recent:///" to be non-native; we special-case it so recent files *will* show up */ { g_set_error_literal (error, GTK_FILE_CHOOSER_ERROR, -- 2.30.2